<!DOCTYPE HTML>
<html>
<head>
    {include file="common_header"}
    <title>添加文章</title>
</head>
<body>
<div class="page-container">
    <form action="{:Url('edit')}" method="post" class="form form-horizontal" id="form">
        <input type="hidden" class="input-text" value="{$data['id']}" name="id">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-1"><span class="c-red">*</span>文章标题：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="{$data['title']}" placeholder="" id="articletitle" name="title" datatype="*" nullmsg="文章标题为空！">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-1">封面图：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="file" class="input-text" value="" placeholder="" id="articletitle2" name="coverFile">
            </div>
            {if condition="$data['cover']"}
            已上传，<a href="javascript:void(0);"  onclick="previewPictures('__UPLOADS__'+'{$data.cover}')" style="color: red;text-decoration: none;">预览</a>
            {/if}
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-1"><span class="c-red">*</span>文章类型：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box">
                    <select name="type" id="type" class="select" datatype="*"  nullmsg="请选择文章类型" onchange="changes($(this).val())">
                         <option disabled selected>请选择文章类型</option>
                          <option value="1" {if condition="$data['type'] eq '图文信息'"}selected{/if}>图文信息</option>
                          <option value="2" {if condition="$data['type'] eq '单篇文章'"}selected{/if}>单篇文章</option>
                     </select>
				</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-1"><span class="c-red">*</span>所属栏目：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span class="select-box">
                    <select name="column_id" id="columnid"  class="select" datatype="*" nullmsg="请选择栏目！" >
                              <option disabled selected value="0">请选择栏目</option>
                        {volist name=':getlist()' id="v"}
                              <option value="{$v['id']}"}>{$v['name']}</option>
                        {/volist}
                     </select>
				</span>
            </div>
        </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">文章摘要：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <textarea name="discription" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" datatype="*"  nullmsg="文章摘要不能为空！" >{$data['discription']}</textarea>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">文章内容：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <textarea  id="content" name="content" cols="30" rows="10" style="width:100%;height:400px;"></textarea>
                    <!--<script id="editor" type="text/plain" style="width:100%;height:400px;"></script>-->
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-1">
                    <button class="btn btn-primary radius" type="submit"> 提交审核</button>
                </div>
            </div>
        </form>
  </div>
{include file="common_footer"}
</body>
<script type="text/javascript">
    $(function () {
        UE.getEditor('content');
    });
    changes("{$data['type']}");
    function    changes(obj) {
            if (obj == "单篇文章") {
                obj =2;
            }else if(obj == "图文信息"){
                obj = 1;
            }
            $('#columnid').find("option[value!='0']").removeAttr("selected");
            $('#columnid').find("option[value!='0']").removeAttr("disabled");
        if(obj==2){
            $("select[name='column_id']").find("option[value='8']").attr("selected",true);
            $("select[name='column_id']").find("option[value!='8']").attr("disabled",true);
        }else{
            $("select[name='column_id']").find("option[value='8']").attr("disabled",true);
            $("select[name='column_id']").find("option[value='0']").attr("disabled",true);
            $("select[name='column_id']").find("option[value='3']").attr("selected",true);
        }
    }
 </script>
</html>